package com.xbongbong.workorder.service;

import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.workorder.pojo.CreateNodeReturnPojo;
import com.xbongbong.pro.workorder.pojo.TimeConsumingOutPojo;
import com.xbongbong.pro.workorder.pojo.dto.ChangeWorkflowDTO;
import com.xbongbong.saas.domain.entity.WorkOrderEntity;
import com.xbongbong.saas.domain.entity.WorkOrderFlowNodeEntity;
import com.xbongbong.saas.domain.entity.WorkOrderStageEntity;
import com.xbongbong.saas.domain.entity.WorkOrderTemplateEntity;
import com.xbongbong.saas.domain.entity.ext.WorkOrderEntityExt;

import java.util.List;

/**
 * 工单基本的操作service
 * @author 魏荣杰
 * @date 2019/3/29 10:36
 * @since v1.0
 * @version v1.0
 */
public interface WorkOrderBasicService {

    /**
     * Description: 根据workOrderStage的refRobId获取用户id（服务）
     * @param corpid 公司id
     * @param refRobId workOrderStage的refRobId（服务）
     * @return java.util.List<java.lang.String> 用户id
     * @author 魏荣杰
     * @date 2019/4/15 9:29
     * @since v1.0
     */
    List<String> getServiceUserIdList(String corpid, String refRobId);
    /**
     * Description: 根据workOrderStage的refRobId获取用户id（部门）
     * @param corpid 公司id
     * @param refRobId workOrderStage的refRobId（部门）
     * @return java.util.List<java.lang.String>
     * @throws XbbException XbbException
     * @author 魏荣杰
     * @date 2019/4/15 9:55
     * @since v1.0
     */
    List<String> getDepartmentUserIdList(String corpid, String refRobId);

    /**
     * 创建新节点
     * 新建工单、指定流程完成进入下一阶段、重启工单
     * @param workOrderEntity 工单
     * @param workOrderTemplateEntity 工单模板
     * @param workOrderStageEntity 阶段
     * @return 推送人和节点负责人
     * @throws XbbException
     */
    CreateNodeReturnPojo createNode(WorkOrderEntity workOrderEntity, WorkOrderTemplateEntity workOrderTemplateEntity, WorkOrderStageEntity workOrderStageEntity) throws XbbException;

    /**
     * 工作流流转
     * @throws XbbException
     */
    void changeWorkflow(ChangeWorkflowDTO changeWorkflowDTO) throws XbbException;

    /**
     * 完成页
     * @param workOrderId
     * @param corpid
     * @return
     */
    List<FieldAttrEntity> completeItem(Long workOrderId, String corpid) throws XbbException;
    /**
     * 回退页
     * @returnF
     */
    List<FieldAttrEntity> rollbackItem();
    /**
     * 关闭页
     * @return
     */
    List<FieldAttrEntity> closeItem();
    /**
     * 转派页
     * @param workOrderId
     * @param corpid
     * @return
     */
    List<FieldAttrEntity> transferItem(Long workOrderId, String corpid) throws XbbException;
    /**
     * 重启页
     * @param workOrderId
     * @param corpid
     * @return
     */
    List<FieldAttrEntity> restartItem(Long workOrderId, String corpid) throws XbbException;

    /**
     * Description: 根据工单主表计算超时,用于回显
     * @return com.xbongbong.pro.workorder.pojo.TimeConsumingOutPojo
     * @author 魏荣杰
     * @date 2019/5/14 19:59
     * @since v1.0
     */
    TimeConsumingOutPojo workOrderConsueTime(WorkOrderEntityExt entity);

    /**
     * Description: 根据工单主表计算超时,用于移动端列表页回显
     * @return com.xbongbong.pro.workorder.pojo.TimeConsumingOutPojo
     * @author long.rao
     * @date 2019-07-08 18:27
     */
    TimeConsumingOutPojo appWorkOrderConsueTime(WorkOrderEntityExt entity);

    /**
     * Description: 根据工单节点表计算超时,用于回显
     * @return com.xbongbong.pro.workorder.pojo.TimeConsumingOutPojo
     * @author 魏荣杰
     * @date 2019/5/14 19:59
     * @since v1.0
     */
    TimeConsumingOutPojo workOrderNodeConsueTime(WorkOrderFlowNodeEntity entity);

    /**
     * Description: 根据工单主表计算工单耗时
     * @return com.xbongbong.pro.workorder.pojo.TimeConsumingOutPojo
     * @author 刘阳
     * @date 2019/6/20 4:35 PM
     * @since v1.0
     */
    TimeConsumingOutPojo workOrderSpecialConsueTime(WorkOrderEntityExt entity);
}
